<?php 
    class CongvanController extends BaseController{
        public function timkiem()
    	{
    	   $filter_title = Input::get('socongvan');
           $ty = Input::get('trichyeu');
           $ngayphathanh = Input::get('create');
    		if($filter_title != '' || $ty !='' || $ngayphathanh !='') {
				$articles = DB::table('congvan')
					->where('congvan.socongvan','like','%'.$filter_title.'%')
                    ->where('congvan.tieude','like','%'.$ty.'%')
                    ->where('congvan.ngayphathanh','like','%'.$ngayphathanh.'%')
					->select('socongvan','tieude')
					->paginate(10);
                    //->whereRaw('(tblarticles.title like ? or tblarticles_category.title like ?)
//						and tblarticles.created_by = ?',array('%'.$filter_title.'%', '%'.$filter_title.'%', $id))
    		} else {    				
				$articles = DB::table('congvan')
				->select('socongvan','tieude')
				->paginate(10);
    		}
            return View::make('fontend.kqcongvandi')->with(array('articles' => $articles));
    	}
        public function tim()
    	{
            return View::make('fontend.congvandi');
    	}
    }
?>